/*
 * klog.h
 * Author: KevinKW
 * Define the interface of klog
 *
 */

#ifndef __KLOG_H__
#define __KLOG_H__

#ifdef __cplusplus
namespace KLOG {}
using namespace KLOG;
extern "C"
{
#endif
#define PATHLEN 256

    typedef enum {
        LogError = 1,
        LogWarning = 2,
        LogInfo = 3,
        LogDebug = 4,
        LogDebug2 = 5,
        LogDebug3 = 6,
        LogMax
    } kLogLevel;

    bool setLogFile(char* logPath, char* filename);
    void getLogFile(char* logPath, char* filename);
    void setLogFileSize(unsigned long long filesize);
    unsigned long long getLogSize();
    void setMaxLogFileNum(unsigned int logFileNum);
    unsigned int getMaxLogFileNum();
    void setLogLevel(kLogLevel level);
    kLogLevel getLogLevel(kLogLevel level);
    void addTime(bool addTime);
    bool isAddTime();
    void addHostname(bool isAddHostName);
    bool isAddHostname();
    void addSeqId(bool addId);
    bool isAddSeqId();
    void klog(kLogLevel logLevel, const char* logFormat, ...);

#define kError(fmt, args...) klog(LogError, fmt, ## args)
#define kWarning(fmt, args...) klog(LogWarning, fmt, ## args)
#define kInfo(fmt, args...) klog(LogInfo, fmt, ## args)
#define kDebug(fmt, args...) klog(LogDebug, fmt, ## args)
#define kDebug2(fmt, args...) klog(LogDebug2, fmt, ## args)
#define kDebug3(fmt, args...) klog(LogDebug3, fmt, ## args)

#ifdef __cplusplus
}
#endif

#endif // __KLOG_H__
